﻿using System;

namespace Affinity.Flux
{
    /// <summary>
    /// Applied to a property to mark it as an outlet: a source from which data flows, or to an event to mark it as a source from which execution flows.
    /// </summary>
    [AttributeUsage(AttributeTargets.Event | AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
    public class OutletAttribute : Attribute
    {
        /// <summary>
        /// Constructor accepting the contract value and any flags for this outlet.
        /// </summary>
        /// <param name="contract"></param>
        /// <param name="flags"></param>
        public OutletAttribute(object contract, OutletFlags flags = OutletFlags.None)
        {
            _Contract = contract;
            _Flags = flags;
        }

        /// <summary>
        /// Gets the contract value for this outlet.
        /// </summary>
        public object Contract
        {
            get { return _Contract; }
        }

        /// <summary>
        /// Gets the flags applied to this outlet.
        /// </summary>
        public OutletFlags Flags
        {
            get { return _Flags; }
        }

        private readonly object _Contract = null;
        private readonly OutletFlags _Flags = OutletFlags.None;
    }
}
